#ifndef TABULATIONTEMPLATE_H
#define TABULATIONTEMPLATE_H

#include "precomp.h"

//#include <QWidget>
//#include <QTableView>
//#include <QLabel>
//#include <QComboBox>
//#include <QLineEdit>
//#include <QDateEdit>
//#include <QPushButton>
//#include <QHBoxLayout>
//#include <QVBoxLayout>
//#include <QSpacerItem>
//#include <QStandardItemModel>
//#include <QMenu>
#include "qpagebar.h"
#include "publicstruct.h"

class TDomain ;

class TabulationTemplate : public QWidget
{
    Q_OBJECT
public:
    explicit TabulationTemplate(QWidget *parent = nullptr);
    ~TabulationTemplate();

    QTableView *m_tableView;
    QWidget *m_filterWidget,*m_actWidget,*m_showWidget;
    QLabel *m_lableEdit,*m_labelComb,*m_labelStart,*m_labelEnd;
    QLineEdit *m_editText;
    QComboBox *m_combSelect;
    QDateEdit *m_dateStart,*m_dateEnd;
    QPushButton *m_btnReset,*m_btnQry,*m_btnAdd,*m_btnDel,*m_btnMod,*m_btnExp;
    QHBoxLayout *m_hFilterLayout,*m_hActLayout;
    QVBoxLayout *m_vShowLayout,*m_vLayout;
    QPageBar  *m_pageBar;
    QSpacerItem *m_actSpacer,*m_filterSpacer;
    QStandardItemModel *m_tableModel;
    QMenu *m_domainInfoMenu,*m_addDomainsMenu;
    TDomain *m_tDomain;
    int m_categoryId;

    void initUi();

    void createDomainInfoRightPopMenu();
    QList<QStandardItem*> createDomainInfoRow(const DomainInfo &domainInfo);
    void dealRecvDataFromServer( QByteArray data,QString flag);
    bool matchWhoisServerInfo(QString domainStr,QString & addrStr,int & port);
    DomainDetailInfo getDomainDetailInfoById(int domainId);
    void clientSocketRequest(QString sendMsg,QString ipAddr,int port);
    void onRefleshDomainTable(int categoryId);
signals:

private slots:
    void slotDomainInfoPopMenu(const QPoint &point);
    void slotRowDoubleClicked(const QModelIndex index);
    void showDomainInfoToTableViewByPage(int categoryId,int curPage);
    void onTextImpDomainRecs();
    void onRuleCreateDomainRecs();
    void onDelCurrentRec();


    void onQryDomainWhois();
    void onQryDomainDns();
    void onQryDomainNetServer();
    void onQryDomainPrice();
};

#endif // TABULATIONTEMPLATE_H
